Skip to content

Add optional subject field to AccessToken (fixes #1038)#2545

Open
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot:add-subject-to-access-token-1038
Open

Add optional subject field to AccessToken (fixes #1038)#2545
internet-dot wants to merge 1 commit intomodelcontextprotocol:mainfrom
internet-dot:add-subject-to-access-token-1038

Conversation

@internet-dot
Copy link
Copy Markdown

This adds an optional subject field to the AccessToken model to store the JWT "sub" (subject) claim, typically the user ID. This enables token verifiers to include user identity in the access token, which can be retrieved via get_access_token().subject in request handlers.

  • Add subject: str | None = None comment with Subject (user ID)
  • Add test verifying the field works and is optional
  • Fully backward compatible (optional field)

…otocol#1038)

Adds a `subject` field to the AccessToken pydantic model to hold the
"sub" claim from JWT tokens. This allows token verifiers to include
the user ID in the access token, which can then be retrieved via
`get_access_token().subject` in request handlers.

The field is optional (str | None) to maintain backward compatibility.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant